from django.db import models

# 作者表
class Author(models.Model):
    name=models.CharField(max_length=32)
    img=models.ImageField(upload_to='img')

    class Meta:
        db_table='author'


class Books(models.Model):
    name=models.CharField(max_length=32)
    author=models.ForeignKey('Author',on_delete=models.CASCADE)
    price=models.DecimalField(max_digits=9,decimal_places=2)
    desc=models.CharField(max_length=1000)
    img=models.ImageField(upload_to='book')

    class Meta:
        db_table='book'

